<?php
    include_once(DAO_PATH . "/ComponentDAO.php");
    include_once(OBJECT_PATH . "/Component.php");
?>

<div class="form-title">Select a component to delete:</div>

<form id="editForm" name="editForm" method="post" action="components.php?action=delete">
<?php
            $dao = new ComponentDAO();
            $list = $dao->getCategoryList();
?>


    <div class="form-label">Category:</div>
    <div class="form-component">
        <select name="category" onchange="getComponents(this.form)">
            <option value="0">Select</option>
            <?php
            $dao = new ComponentDAO();
            $list = $dao->getCategoryList();

            $iterator = $list->getIterator();
            while ($iterator->valid())
            {
                $category = $iterator->current();
                ?>
                <option value="<?php echo $category->getId(); ?>"><?php echo $category->getName(); ?></option>
                <?php
                $iterator->next();
            }
            ?>
        </select>
    </div>

    <div class="form-label">Component:</div>
    <div class="form-component">
        <select name="component" id="component">
            <option value="0">Select</option>;
        </select>
    </div>

    <div style="text-align: center;">
        <input type="submit" value="Delete" />
        <input type="reset" value="Reset" />
    </div>

</form>